package com.nicefact.util;

import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

import com.nicefact.ServerCommonConstant;
import com.nicefact.core.AppException;

public class PropertyUtil {

	public static String getProperty(String key) throws AppException {
		InputStream ipathshalaPropertiesLoadStream = PropertyUtil.class
				.getClassLoader().getResourceAsStream(
						ServerCommonConstant.IPATHSHALA_PROPERTY_FILE);
		if (ipathshalaPropertiesLoadStream == null) {
			throw new AppException(
					"Cannod read from Ipathshala properties file");
		}
		Properties ipathshalaProperties = new Properties();
		try {
			ipathshalaProperties.load(ipathshalaPropertiesLoadStream);
		} catch (IOException e) {
			throw new AppException(
					"Cannod read from Ipathshala properties file");
		}
		String propertyValue = ipathshalaProperties.getProperty(key);

		return propertyValue;

	}

}
